//
//  IMISoundPlayer.h
//
//  Created by Travis on 09-6-10.
//  Copyright 2009 imi.im  All rights reserved.
//

/*!
    @header IMISoundPlayer
    @abstract   
    @discussion Reqires: AudioToolbox & OpenAL & AVFoundation
*/


#import "IMIBasePrefix.h"
#import "CocosDenshion.h"
#import "CDAudioManager.h"

/**
 A wrapper to the CDAudioManager object.
 This is recommended for basic audio requirements. If you just want to play some sound fx
 and some background music and have no interest in learning the lower level workings then
 this is the interface to use.
 
 Requirements:
 - Firmware: OS 2.2 or greater 
 - Files: IMISoundPlayer.*, CocosDenshion.*
 - Frameworks: OpenAL, AudioToolbox, AVFoundation
 @since v0.8
 */
@interface IMISoundPlayer : NSObject {
	BOOL	muted_;
}

/** whether or not the engine is muted */
@property (readwrite) BOOL muted;
/** Background music volume. Range is 0.0f to 1.0f */
@property (readwrite) float backgroundMusicVolume;
/** Effects volume. Range is 0.0f to 1.0f */
@property (readwrite) float effectsVolume;

/** returns the shared instance of the SimpleAudioEngine object */
+ (IMISoundPlayer*) sharedPlayer;

/** plays background music in a loop*/
-(void) playBackgroundMusic:(NSString*) filePath;
/** plays background music, if loop is true the music will repeat otherwise it will be played once */
-(void) playBackgroundMusic:(NSString*) filePath loop:(BOOL) loop;
/** stops playing background music */
-(void) stopBackgroundMusic;
/** pauses the background music */
-(void) pauseBackgroundMusic;
/** rewind the background music */
-(void) rewindBackgroundMusic;
/** returns whether or not the background music is playing */
-(BOOL) isBackgroundMusicPlaying;

/** plays an audio effect with a file path*/
-(ALuint) playEffect:(NSString*) filePath;
/** plays an audio effect with a file path will repeat or not*/
-(ALuint) playEffect:(NSString*) filePath loop:(BOOL)b;
/** plays an audio effect with a file path, pitch, pan and gain */
-(ALuint) playEffect:(NSString*) filePath pitch:(Float32) pitch pan:(Float32) pan gain:(Float32) gain loop:(BOOL)b;
/** preloads an audio effect */
-(void) preloadEffect:(NSString*) filePath;
/** stop an audio effect */
-(void)	stopEffect:(NSString*) filePath;
/** unloads an audio effect from memory */
-(void) unloadEffect:(NSString*) filePath;

@end
